from utils import find_proper_divisors

amicables = []
d = lambda n: sum(find_proper_divisors(n))
for a in range(1, 10000):
    if a in amicables:
        continue
    b = d(a)
    if b != a and a == d(b):
        amicables += [a, b]
 
print sum(amicables)
